<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item><i class="el-icon-edit-outline"></i> 项目申请</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <el-button
      v-if='isShow && isShowBtn'
      type='primary'
      icon='el-icon-plus'
      style='float: right; margin: 10px 40px'
      @click="applyNewProject('new')"
    >申请新项目</el-button>
    <!-- 新项目返回按钮 -->
    <el-button
      v-if="!isShow"
      type='warning'
      style='float: right; margin: 10px 10% 10px 40px'
      @click='backClick'
    >返 回</el-button>
    <!-- 项目列表 -->
    <ApplyForList
      @handleIsShow="handleIsShow"
      v-on:childByValue="childByValue"
      v-if='isShow'
      :isShow="isShow"
    ></ApplyForList>
    <!-- 申请项目 -->
    <ApplyFor
      :row="row"
      v-if='isShow == false'
    ></ApplyFor>
  </div>
</template>

<script>
import ApplyForList from '@/views/backStage/ApplyFor/ApplyForList';
import ApplyFor from '@/views/backStage/ApplyFor/ApplyFor';
import Basic from '@/views/backStage/Tabs/components/Basic';
import Digest from '@/views/backStage/Tabs/components/Digest';
import Institution from '@/views/backStage/Tabs/components/Institution';
import Datum from '@/views/backStage/Tabs/components/Datum';

export default {
    components: {
        ApplyForList,
        ApplyFor
    },
    data() {
        return {
            ip: '',
            row: {},
            isShow: true,
            isShowBtn: true // 自组件控制
        };
    },
    mounted() {
        this.ready();
        // this.applyNewProject();
    },
    methods: {
        ready() {
            let cip = returnCitySN['cip'];
            let cid = returnCitySN['cid'];
            let cname = returnCitySN['cname'];
            this.ip = cip;
        },
        handleIsShow(val) {
            this.isShow = false;
            this.row = val;
        },
        // 获取列表
        // async getUserTabListData() {
        //     const res = await getUserTabListAPI({
        //         token: this.$store.state.user.token,
        //         oprid: this.$store.state.user.oprid
        //     });
        //     this.tableList = res.result;
        // },
        backClick() {
            this.isShow = true;
            // this.getUserTabListData();
        },
        childByValue(childValue) {
            // childValue就是子组件传过来的值
            this.isShowBtn = childValue;
        },
        // 点击申请新项目按钮
        applyNewProject(text) {
            this.isShow = false;
            this.$store.dispatch('applyFor/editFlag', text);
        }
    }
};
</script>

<style scoped>
</style>
